package cn.com.nes.site.entity.em.crm.clue;

import cn.com.nes.common.exception.NoSuchEnumException;

import java.util.HashMap;
import java.util.Map;

/**
 * 线索分配状态 枚举
 *  值域对应 t_param 表 param_type=15
 */
public enum ClueDistributeStateEnum {

    DISTRIBUTE("01", "已分配"),
    NO_DISTRIBUTE("02", "未分配"),

    ;

    private String key;

    private String value;

    ClueDistributeStateEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static ClueDistributeStateEnum getEnum(String key) {
        Map<String, ClueDistributeStateEnum> map = new HashMap<>();
        for (ClueDistributeStateEnum clueDistributeStateEnum : values()) {
            map.put(clueDistributeStateEnum.getKey(), clueDistributeStateEnum);
        }
        if (!map.containsKey(key)) {
            throw new NoSuchEnumException("未匹配的线索分配状态");
        }
        return map.get(String.valueOf(key));
    }

}
